
var connection = require("../../app_modules/dbAccess/mongoConfig.js");
var mongoose = require('mongoose');
var db = mongoose.createConnection(connection.getConnectionString("")); //连接test数据库
//var db = mongoose.Connection(connection.getConnectionString(""));

var Schema = mongoose.Schema; //创建模型【骨架模板】
var companyNewSchema = new Schema({
    title: String,
    content:String,
    order:String,
    type:String,
    newImg:String,
	IsUrl:Boolean,
	Url:String,
    createDate:Date,

});

companyNewSchema.methods.add = function (companyNew, callback) {
    this.title = companyNew.title;
    this.content = companyNew.content;
    this.createDate = companyNew.createDate;
    this.order=companyNew.order;
    this.type=companyNew.type;
    this.newImg=companyNew.newImg;
	this.IsUrl=companyNew.IsUrl;
	this.Url=companyNew.Url;
    this.save(callback);
}
var companyNew = db.model('companyNews', companyNewSchema);
module.exports = companyNew;
